<?php
class Sfs_Controller_Action_Helper_Js  extends  Zend_Controller_Action_Helper_Abstract
{

	public function direct($fileName)
	{
		//$this->getHelper('layout')->disableLayout();
		Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true);
		Zend_Layout::getMvcInstance()->disableLayout();
		// 取得 view
		$view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;

		$path = $view->getScriptPaths();

		$file_name = $path[0].'js/'.$fileName.'.js';
        if (! is_file($file_name))
            throw new Exception(" No such file  $file_name") ;
		if ($data = file_get_contents($file_name)) {
			$response = $this->getResponse();
        	$response->setBody($data);
		}
	}
}
